
import com.adobe.cairngorm.control.CairngormEventDispatcher;

import net.optix.ip.events.AssignTradeMarkToFirmEvent;
import net.optix.ip.events.GetFirmsEvent;
import net.optix.ip.events.GetOrderFirmsEvent;
import net.optix.ip.model.ModelLocator;
import net.optix.ip.vo.TradeMarkVO;
[Bindable]
private var model:ModelLocator	=	ModelLocator.getInstance();

private function initApp():void
{
	var getFirms:GetOrderFirmsEvent	=	new GetOrderFirmsEvent();
	com.adobe.cairngorm.control.CairngormEventDispatcher.getInstance().dispatchEvent(getFirms);
}

private function assign():void
{
	var vo:TradeMarkVO	=	model.currentTradeMark;
	vo.firmID			=	firms.selectedItem.firmID;
	vo.maxBudget		=	int(maxBudget.text);
	vo.deadlineDate		=	deadlineDate.text;
	
	var event:AssignTradeMarkToFirmEvent	=	new AssignTradeMarkToFirmEvent(vo);
	com.adobe.cairngorm.control.CairngormEventDispatcher.getInstance().dispatchEvent(event);	
}

[Bindable]
private var welcome:String;

private var _mark:TradeMarkVO;

public function set mark(value:TradeMarkVO):void
{
	_mark	=	value;
	if(_mark.firmID == 0)
	{
		welcome	=	"Assign the trademark to a law firm without requesting a bid";
	}
	else
	{
		switch(_mark.bConfirm)
		{
			case -1:
				welcome	=	"The firm "+_mark.firmName+" decline your assign !";
				break;
			case 0:
				welcome	=	"You assign the invention to firm : "+_mark.firmName;
				break;
			case 1:
				welcome	=	"The firm : "+_mark.firmName+" accept your assign !";
				break;
		}
	}
	
}

public function get mark():TradeMarkVO
{
	return _mark;
}